//
//  LRGuideViewController.m
//  本地生活圈
//
//  Created by admin on 15/8/9.
//  Copyright (c) 2015年 懒人. All rights reserved.
//

#import "LRGuideViewController.h"

@interface LRGuideViewController ()

@end

@implementation LRGuideViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    UIScrollView *scrollView = [[UIScrollView alloc]initWithFrame:self.view.bounds];
    
    scrollView.contentSize = CGSizeMake(3 * kUIScreenW, 0);
    
    [scrollView setShowsVerticalScrollIndicator:NO];
    
    scrollView.showsHorizontalScrollIndicator = NO;
    
    scrollView.PagingEnabled = YES;
    
    for (int i = 0; i < 3; i ++)
    {
        NSString *imgName = [NSString stringWithFormat:@"guide_%d",i];
        
        UIImage *image = [UIImage imageNamed:imgName];
        
        CGFloat imageW = kUIScreenW;
        
        UIImageView *imageView = [[UIImageView alloc]initWithImage:image];
        
        imageView.frame = CGRectMake(imageW * i, 0, imageW, kUIScreenH);
        
        [scrollView addSubview:imageView];
        
        // 添加单击手势
        if (i == 2)
        {
            imageView.userInteractionEnabled = YES;
            UITapGestureRecognizer *tapGes = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(login)];
            [imageView addGestureRecognizer:tapGes];
        }

    }

    [self.view addSubview:scrollView];
    
    self.hidesBottomBarWhenPushed = YES;
    
//        CGRect rect = [UIScreen mainScreen].bounds;

}

- (void)login
{
    [[NSNotificationCenter defaultCenter]postNotificationName:kLogin object:nil];

    [LRFunction saveBool:YES key:kLogin];
}

- (void)dealloc
{
//    [[NSNotificationCenter defaultCenter] removeObserver:self];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
    
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
